package com.dorukdestan.p2pshare.model;

import java.io.File;
import java.io.FileFilter;

public class Constants {
	
	public static String SAVE_PATH = "/home/destan/Desktop";
	
	public static int UDP_PORT_NUMBER;
	public static int TCP_PORT_NUMBER;

	public static long timeoutForGettingAnswers;
	public static long timeoutForNearestPeersValidation;
	
	public static final int NEAREST_PEERS_NUM;
	public static final int FILE_CHUNK_SIZE;
	
	public static final FileFilter fileFilter;
	public static final FileFilter directoryFilter;
	
	private static int downloadedFileCount = 0;
	
	public synchronized static int getAndIncrementDownloadedFileCount() {
		return downloadedFileCount++;
	}

	static{
		UDP_PORT_NUMBER = 22344;
		TCP_PORT_NUMBER = 12345;
		timeoutForGettingAnswers = 6000;
		timeoutForNearestPeersValidation = 60000;
		
		NEAREST_PEERS_NUM = 2;
		FILE_CHUNK_SIZE = 256;
		
		fileFilter = new FileFilter() {
			
			@Override
			public boolean accept(File file) {
				return file.isFile();
			}
		};
		
		directoryFilter = new FileFilter() {
			
			@Override
			public boolean accept(File paramFile) {
				return paramFile.isDirectory();
			}
		};
	}
}
